Typed Exeptions and Continuations Cannot Macro-Express Each Other
نویسندگان
چکیده
The most powerful control constructs in modern programming languages are continuations and exceptions. Although they can be used interchangeably in some cases, they are fundamentally different semantically. We consider two simply-typed functional languages with exceptions and continuations, respectively. We give theorems, one that holds in the language with exceptions and one that holds in the language with continuations. A fortiori, these theorems imply that exception constructs cannot be used to macro-express continuation constructs, and that continuation constructs cannot be used to macro-express exception constructs.
منابع مشابه
Typed Exceptions and Continuations Cannot Macro-Express Each Other
The most powerful control constructs in modern programming languages are continuations and exceptions. Although they can be used interchangeably in some cases, they are fundamentally different semantically. We consider two simply-typed functional languages with exceptions and continuations, respectively. We give two theorems, one that holds in the language with exceptions and one that holds in ...
متن کاملTyped Dynamic Control Operators for Delimited Continuations
We study the dynamic control operators for delimited continuations, control and prompt. Based on recent developments on purely functional CPS translations for them, we introduce a polymorphically typed calculus for these control operators which allows answer-type modification. We show that our calculus enjoys type soundness and is compatible with the CPS translation. We also show that the typed...
متن کاملCapturing the Future by Replaying the Past
Delimited continuations are the mother of all monads! So goes the slogan inspired by Filinski’s 1994 paper, which showed that delimited continuations can implement any monadic e ect, letting the programmer use an e ect as easily as if it was built into the language. It’s a shame that not many languages have delimited continuations. Luckily, exceptions and state are also the mother of all monads...
متن کاملA monadic framework for delimited continuations
Delimited continuations are more expressive than traditional abortive continuations and they apparently require a framework beyond traditional continuation-passing style (CPS). We show that this is not the case: standard CPS is sufficient to explain the common control operators for delimited continuations. We demonstrate this fact and present an implementation as a Scheme library. We then inves...
متن کاملShift to control
Delimited control operators abound, but their relationships are illunderstood, and it remains unclear which (if any) to consider canonical. Although all delimited control operators ever proposed can be implemented using undelimited continuations and mutable state, Gasbichler and Sperber [28] showed that an implementation that does not rely on undelimited continuations can be much more efficient...
متن کامل